﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Controls;
using System.Collections;
using System.Windows;
using UIObjects;

namespace MvvmTreeView
{
    public delegate void BusyHandler(ITreeNode treeNode, bool busy);
    public delegate void StatusHandler(ITreeNode treeNode, string status);
    public delegate void RootNodesAvailableHandler(ITreeView treeView, TreeNodeCollection rootNodes);
    public delegate void OnResetNodeMenuHandler(ITreeNode treeNode);
    public delegate void NodeSelectedHandler(ITreeView treeView, ITreeNode node);
    public delegate void OnAddEditNodeHandler(ITreeNode parentNode, int imageIndex, string text, ref EditNode editNode);
    public delegate void OnBeginEditHandler(ITreeNode node);
    public delegate void OnEndEditHandler(ITreeNode node, bool cancel);

    public interface ITreeView
    {
        event OnAddEditNodeHandler OnAddEditNode;
        event OnBeginEditHandler OnBeginEdit;
        event OnEndEditHandler OnEndEdit;
        event StatusHandler OnStatus;
        event BusyHandler Busy;
        event NodeSelectedHandler NodeSelected;
        event EventHandler NodeDblClick;
        event OnResetNodeMenuHandler OnResetNodeMenu;
        void FireNodeSelected(ITreeNode node);
        void FireNodeDblClick(ITreeNode node, EventArgs e);
        event RootNodesAvailableHandler RootNodesAvailable;
        void SetBusy(ITreeNode treeNode, bool busy);
        Color BackColor { get; set; }
        Image BackgroundImage { get; set; }
        ////ImageLayout BackgroundImageLayout { get; set; }
        ////BorderStyle BorderStyle { get; set; }
        bool CheckBoxes { get; set; }
        ////protected Size DefaultSize { get; }
        Color ForeColor { get; set; }
        bool HideSelection { get; set; }
        int ImageIndex { get; set; }
        string ImageKey { get; set; }
        ImageList ImageList { get; set; }
        int Indent { get; set; }
        int ItemHeight { get; set; }
        bool LabelEdit { get; set; }
        Color LineColor { get; set; }
        TreeNodeCollection Nodes { get; }
        ////Padding Padding { get; set; }
        string PathSeparator { get; set; }
        bool RightToLeftLayout { get; set; }
        bool Scrollable { get; set; }
        int SelectedImageIndex { get; set; }
        string SelectedImageKey { get; set; }
        ITreeNode SelectedNode { get; set; }
        bool ShowLines { get; set; }
        bool ShowNodeToolTips { get; set; }
        bool ShowPlusMinus { get; set; }
        bool ShowRootLines { get; set; }
        bool Sorted { get; set; }
        ImageList StateImageList { get; set; }
        string Text { get; set; }
        TreeView InternalTreeView { get; set; }
        ITreeNode TopNode { get; set; }
        IComparer TreeViewNodeSorter { get; set; }
        int VisibleCount { get; }
        ////event TreeViewEventHandler AfterCheck;
        ////event TreeViewEventHandler AfterCollapse;
        ////event TreeViewEventHandler AfterExpand;
        ////event TreeViewEventHandler AfterSelect;
        event EventHandler BackgroundImageChanged;
        event EventHandler BackgroundImageLayoutChanged;
        ////event TreeViewCancelEventHandler BeforeCheck;
        ////event TreeViewCancelEventHandler BeforeCollapse;
        ////event TreeViewCancelEventHandler BeforeExpand;
        ////event TreeViewCancelEventHandler BeforeSelect;
        ////event DrawTreeNodeEventHandler DrawNode;
        ////event ItemDragEventHandler ItemDrag;
        ////event TreeNodeMouseClickEventHandler NodeMouseClick;
        ////event TreeNodeMouseClickEventHandler NodeMouseDoubleClick;
        ////event TreeNodeMouseHoverEventHandler NodeMouseHover;
        event EventHandler PaddingChanged;
        ////event PaintEventHandler Paint;
        event EventHandler RightToLeftLayoutChanged;
        event EventHandler TextChanged;
        void BeginEdit(ITreeNode node);
        void EndEdit(ITreeNode node, bool cancel);
        void BeginUpdate();
        void CollapseAll();
        void EndUpdate();
        void ExpandAll();
        ////protected OwnerDrawPropertyBag GetItemRenderStyles(ITreeNode node, int state);
        ITreeNode GetNodeAt(Point pt);
        ITreeNode GetNodeAt(int x, int y);
        int GetNodeCount(bool includeSubTrees);
        ////TreeViewHitTestInfo HitTest(Point pt);
        ////TreeViewHitTestInfo HitTest(int x, int y);
        ////protected bool IsInputKey(Keys keyData);
        ////protected void OnAfterCheck(TreeViewEventArgs e);
        ////protected internal void OnAfterCollapse(TreeViewEventArgs e);
        ////protected void OnAfterExpand(TreeViewEventArgs e);
        ////protected void OnAfterSelect(TreeViewEventArgs e);
        ////protected void OnBeforeCheck(TreeViewCancelEventArgs e);
        ////protected internal void OnBeforeCollapse(TreeViewCancelEventArgs e);
        ////protected void OnBeforeExpand(TreeViewCancelEventArgs e);
        ////protected void OnBeforeSelect(TreeViewCancelEventArgs e);
        ////protected void OnDrawNode(DrawTreeNodeEventArgs e);
        ////protected void OnItemDrag(ItemDragEventArgs e);
        ////protected void OnKeyDown(KeyEventArgs e);
        ////protected void OnKeyPress(KeyPressEventArgs e);
        ////protected void OnKeyUp(KeyEventArgs e);
        ////protected void OnMouseHover(EventArgs e);
        ////protected void OnMouseLeave(EventArgs e);
        ////protected void OnNodeMouseClick(TreeNodeMouseClickEventArgs e);
        ////protected void OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e);
        ////protected void OnNodeMouseHover(TreeNodeMouseHoverEventArgs e);
        ////protected void OnRightToLeftLayoutChanged(EventArgs e);
        void Sort();
        string ToString();
        void ResetNodeMenu(ITreeNode treeNode);
        EditNode AddEditNode(ITreeNode parentNode, int imageIndex, string text);
        ILog Log { get; set; }
    }
}
